Skip to content

Error out if alias tensor args are consumed by in-place ops#798

Merged
t-vi merged 14 commits intomainfrom
crpa/alias-detector
Aug 1, 2024
Merged

Error out if alias tensor args are consumed by in-place ops#798
t-vi merged 14 commits intomainfrom
crpa/alias-detector

Conversation

@crcrpar
Copy link
Copy Markdown
Collaborator

@crcrpar crcrpar commented Jul 18, 2024

Before submitting
  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes # (issue).

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

Copy link
Copy Markdown
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @crcrpar , thank you for working on this!

I am not sure that we're checking at the right place - and that we should be putting this on the TensorProxies:

  • to my mind, we need to do the aliasing check on every invocation (including cached), with all the speed requirement implications, so maybe only for tensors where it is relevant...
  • if we wanted to support this down the road (shared weights might be an important case depending on whether they come out as different or same args), we would need to check for this in the prologue (but this is future probably).

@crcrpar crcrpar force-pushed the crpa/alias-detector branch 4 times, most recently from ee000e7 to 8351339 Compare July 26, 2024 06:56
@crcrpar crcrpar changed the title aliased arguments detector Error out if alias tensor args are consumed by in-place ops Jul 26, 2024
@crcrpar crcrpar marked this pull request as ready for review July 26, 2024 06:58
@crcrpar crcrpar requested review from lantiga and mruberry as code owners July 26, 2024 06:58
@crcrpar crcrpar requested a review from t-vi July 26, 2024 06:58
@crcrpar crcrpar force-pushed the crpa/alias-detector branch from 1e53c01 to 98b3fab Compare July 29, 2024 11:05
@crcrpar crcrpar force-pushed the crpa/alias-detector branch from 98b3fab to fb00905 Compare July 30, 2024 11:26
@crcrpar crcrpar force-pushed the crpa/alias-detector branch from ad6e536 to 5a286f7 Compare July 31, 2024 12:10
crcrpar added 12 commits July 31, 2024 22:52
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
@crcrpar crcrpar force-pushed the crpa/alias-detector branch from 5a286f7 to 52c7291 Compare July 31, 2024 13:57
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
@crcrpar crcrpar force-pushed the crpa/alias-detector branch from 52c7291 to ac1481b Compare July 31, 2024 14:03
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
# alaises wouldn't matter, thus it'd be better to nullify this entry in such cases.
# It however would require the functionalized computation trace to interact with `cache_info`,
# which seems to break the consistency of cache_info, leading to a failure in cache_info check.
cache_info["alias_tensor_indices"] = _alias_tensor_of_args_kwargs(*args, **kwargs)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you would not want to change the cache info, you can grab the prologue check for it and remove it. It would be better to actually not collect the information in this case, but I guess that's how it is for now.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were to support the combo of in-place ops and alias tensor args, I do find it better to have separate traces whether or not the args include alias tensors

Copy link
Copy Markdown
Collaborator

@t-vi t-vi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @crcrpar I think we can address the comment in a follow up or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants